package coreutil

import "net/http"

type fileUtil struct {
}

func (p *fileUtil) GetFileContentType(data *[]byte) string {
	var buffer []byte
	if len(*data) < 512 {
		//		return "application/octet-stream"
		buffer = *data
	} else {
		buffer = (*data)[0:512]
	}

	contentType := http.DetectContentType(buffer)
	if "" == contentType {
		contentType = "application/octet-stream"
	}
	return contentType
}

var (
	FileUtil = &fileUtil{}
)
